import React from "react";
import { useTranslation } from "react-i18next";
import AdminLayout from "@/user.InterfaceLayer/Libraries/Layouts/Admin.layout";
import TestTableAdmin from "@/user.InterfaceLayer/Libraries/Widgets/TestTableAdmin.widget";
import { useAdminProducts } from "@/business.InterfaceLayer/hooks/store/useAdminQueryStore";
import useFilterProducts from "@/business.InterfaceLayer/hooks/useFilterProducts";
import useSortFilters from "@/business.InterfaceLayer/hooks/useSortFiltersQuery";

interface ProductsPageProps {}

const ProductsPage: React.FC<ProductsPageProps> = () => {
  const { t } = useTranslation();
  const { adminProducts, isLoading } = useAdminProducts();
  const { filters, applyFilters, clearFilters } = useSortFilters();

  const filteredProducts = useFilterProducts(adminProducts);

  return (
    <AdminLayout
      title={t("AdminPage.title.products")}
      isLoading={isLoading}
      // error={error}
      // block={<AdminProducts items={products} />}
      block={
        <TestTableAdmin
          filters={filters}
          applyFilters={applyFilters}
          t={t}
          products={filteredProducts}
        />
      }
    />
  );
};
export default ProductsPage;
